package com.thp.proxy.custom;

import com.thp.proxy.model.Eat;
import com.thp.proxy.model.Person;

import java.lang.reflect.Method;

public class Witchcraft implements  MyInvocationHandler {


    private Eat target;

    public Object getInstance(Eat target) {
        this.target = target;
        Class clazz = target.getClass();
        return MyProxy.newProxyInstance(new MyClassLoader(), clazz.getInterfaces(), this);
    }



    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {

        System.out.println("--------------");
        method.invoke(this.target, args);
        System.out.println("--------------");

        return null;
    }




}
